#define _CRT_SECURE_NO_WARNINGS  1
#include<stdio.h>
int count[1001][1001];
int count2[1001][1001];
int main()
{
	int n, m, k;
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			int x;
			scanf("%d", &x);
			count[i][x] = j;
		}
	}
	for (int j = 1; j <= k; j++)
	{
		for (int i = 1; i <= n; i++)
		{
	
			if (count[i][j])
			{
				count2[j][count[i][j]] = 1;
			}
		}
	}
	int sum = 0;
	for (int i = 1; i <= k; i++)
	{
		sum = 0;
		for (int j = 1; j <= k; j++)
		{
			sum += count2[i][j];
		}
		printf("%d ", sum);
	}
	return 0;
}

//#include <cstdio>
//#include <algorithm>
//#include <cstring>
//using namespace std;
//
//int n, m, k, tot[10], vis[10][10], a[10][10];
//
//int main() {
//	scanf("%d%d%d", &n, &m, &k);
//	for (int i = 1; i <= n; ++i)
//		for (int j = 1; j <= m; ++j)
//			scanf("%d", &a[i][j]);
//	for (int i = 1; i <= n; ++i) {
//		for (int j = 1; j <= m; ++j) {
//			if (!vis[j][a[i][j]]) {
//				vis[j][a[i][j]] = 1;
//				tot[a[i][j]]++;
//			}
//		}
//	}
//	for (int i = 1; i <= k; ++i)
//		printf("%d ", tot[i]);
//	return 0;
//}